package cate.game.play.skill.passive.fairy;

import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.skill.effect.SkillEffect;
import cate.game.play.skill.passive.PassiveHandler;
import cate.game.play.skill.passive.hero.附香PH;

/**
 * 效果1：“附香”回血比例提升至18%,新增效果; 战斗开始前提升所有友军5%暴击率4回合，不可驱散!
 * 效果2："回味"驱散的增益BUFF数量从1个变为所有增益BUFF
 */
public class 冬阴功灵器PH extends PassiveHandler {

	private double 提升比例;

	private String 驱散标签;

	//提升比例=1800&驱散标签=回味驱散
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		提升比例 = args.getWDouble("提升比例", 0d);
		驱散标签 = args.getString("驱散标签", null);
	}

	@Override
	public void onFirstEnter(ActionCtx action) {
		for (PassiveHandler handler : skill.owner.skill.getHandlers()) {
			if (handler instanceof 附香PH) {
				((附香PH) handler).addHealCoeff(提升比例);
				break;
			}
		}
	}


	@Override
	public void beforeSkillSettleAsActor(SkillActionCtx action, SkillEffect effect, Fighter target) {
		if(action.getSkill().cfg.containTag(驱散标签)){
			return;
		}
		effect.addDispelLimit(-1);
	}
}
